// 获取搜索 商品
const getSearchGoodsListSync = (state, goodsList) => {
	state.goodsList = goodsList;
}
// 首页商品数据
const getIndexGoodsSync = (state, indexGoodsData) => {
	for(var i = 0; i < indexGoodsData.length; i++) {
		if(indexGoodsData[i].type === "recommend" || indexGoodsData[i].type === "goods_select") {
			for(var j = 0; j < indexGoodsData[i].data.length; j++) {
				indexGoodsData[i].data[j].goods_image1 = indexGoodsData[i].data[j].goods_imgs.split(",")[0];
				if(indexGoodsData[i].data[j].goods_label == 1) {
					indexGoodsData[i].data[j].goods_label_text = "月定制";
				}
				if(indexGoodsData[i].data[j].goods_label == 2) {
					indexGoodsData[i].data[j].goods_label_text = "拼团";
				}
				if(indexGoodsData[i].data[j].goods_label == 3) {
					indexGoodsData[i].data[j].goods_label_text = "众筹";
				}
			}
		}
	}
	state.indexData = indexGoodsData
}
// 首页分类数据
const getIndexClassifySync = (state, classifyData) => {
	state.classifyData = classifyData
}

// 根据分类id获取商品数据
const getClassifyGoodsDataSync = (state, classifyGoodsData) => {
	state.classifyGoodsData = classifyGoodsData
}
// 设置拼团成员头像
const setShareMemberInfo = (state, memberAvatarList) => {
	state.memberAvatarList = memberAvatarList
}
export default {
	getSearchGoodsListSync,
	getIndexGoodsSync,
	getIndexClassifySync,
	getClassifyGoodsDataSync,
}